Skip to main content

answer color

Type​

command

Summary​

Displays the operating system's standard color-selection dialog box.

Syntax​

answer color [with <startingColor>]

Description​

Use the answer color command to select a custom color.

The answer color command displays a dialog box where the user can select a color. (This dialog box is displayed by the operating system, not by LiveCode.)

If you specify a startingColor, the dialog box displays that color by default.

The color is returned in the form of three comma-separated integers between zero and 255, specifying the level of each of red, green, and blue. This format can be used directly to set any color property.

Parameters​

NameTypeDescription

startingColor

A color reference in one of the following forms:

  • a standard color name
  • three comma-separated integers between zero and 255, specifying the
   level of each of red, green, and blue
- an HTML-style color consisting of a hash mark (#) followed by three
hexadecimal numbers, one for each of red, green, and blue.

Examples​

answer color
if theItem is "Custom Color..." then answer color
answer color with "#FF0033"
answer color with "AliceBlue"

Value​

NameTypeDescription

it

The color the user chooses is placed in the it variable.

the result

If the user cancels the dialog, the it variable is set to empty, and the result function returns "Cancel".

property: backgroundColor, colors, foregroundColor

command: answer

control structure: function

function: result, colorNames

glossary: dialog box, variable, command, return, color reference

keyword: it

Compatibility and Support​

Introduced

LiveCode 1.1

OS

mac

windows

linux

Platforms

desktop

Thank you for your feedback!

Was this page helpful?